-
Notifications
You must be signed in to change notification settings - Fork 24
ManagedSharedPtr #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ManagedSharedPtr #298
Conversation
…eters working w/ record.
…cussing on make_shared as the only construction option for now.
…edPtrManager copies working correctly with umpire/chai.
…nd CHAICopyable status of type.
…Non CHAICopyable const type test.
…ehavior from non-poly types in ManagedSharedPtr.
… memory map dtor); Rename shared ptr tests to a more appropriate filename.
…t are CHAICopyable.
53b4ea9
to
b7d1cf0
Compare
Could you add a new CMake configuration variable? Something like CHAI_ENABLE_EXPERIMENTAL? Then in CMakeLists.txt only add the new files if CHAI_ENABLE_EXPERIMENTAL is on. |
Done, the option by default disables tests in all of the CI jobs. We probably want to keep testing experimental features so they aren't broken, wheres the best place to define that flag for Chai's CI pipeline? |
// trigger a moveInnerImpl, which expects inner values to be initialized. | ||
template <bool B = std::is_base_of<CHAICopyable, T>::value, | ||
typename std::enable_if<B, int>::type = 0> | ||
CHAI_HOST bool initInner(size_t start = 0) | ||
{ | ||
for (size_t i = start; i < m_size/sizeof(T); ++i) { | ||
m_active_base_pointer[i] = nullptr; | ||
new (&m_active_base_pointer[i]) T(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these changes fix other behaviors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it allows default construction of more complex nested chai managed types that would be elements of a managed array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
chai::expt::ManagedSharedPtr
, a smart pointer enabling implicit migration of polymorphic types between host and device memory spaces.ManagedSharedPtr
, you can safely copy a base shared pointer and invoke derived class functionality using the device-side v-table.This has been placed under the
expt
names space per @adayton1's request since much of the implementation is a duplicate of the underlying logic forchai::ManagedArray
.This work is necessary for the Spheral GPU port.